package com.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.SubletMapper;
import com.pojo.Sublet;
import com.service.SubletService;
import com.vo.SubletVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SubletServiceimpl implements SubletService {
    @Resource
    private SubletMapper subletMapper;
    @Override
    public int insertSelective(Sublet record) {
        int i = subletMapper.insertSelective(record);
        return i;
    }

    @Override
    public PageInfo<Sublet> selectsubletall(SubletVo subletVo) {

        PageHelper.startPage(subletVo.getPage(),subletVo.getLimit());
        List<Sublet> selectsubletall = subletMapper.selectsubletall(subletVo);
        PageInfo<Sublet> pageInfo=new PageInfo<>(selectsubletall);

        return pageInfo;
    }

    @Override
    public int deleteByhouseid(Integer id) {
        int i = subletMapper.deleteByhouseid(id);
        return i;
    }

    @Override
    public Sublet selectByhouseid(Integer id) {
        Sublet sublet = subletMapper.selectByhouseid(id);
        return sublet;
    }
}
